<?php
class fluxslider extends CI_Controls{

	//https://github.com/joelambert/Flux-Slider
	//otro http://tympanus.net/codrops/2011/09/05/slicebox-3d-image-slider/
	
	public $autoplay;
	public $imagenes;
	public $controls;
	public $transitions;
	public $delay;

	
	function drawContent(){

	$div= new div();
		$div->atributos=$this->atributos;
		//creo la estructura

		$imagenes=$this->imagenes;
		$nimagenes=count($imagenes);
		for($i=0;$i<$nimagenes;++$i){
			$img=new img();
			$img->att('id','img_'.$i);
			$img->att('src',$imagenes[$i]);
			$div->addControl($img);
		}
		$this->fluxsliderScript();
		return  $div;

	}

	private function fluxsliderScript(){
		

		$this->CI->dynamic_assets->add_js(base_url('js/vendor/fluxSlider/flux.min.js'));
		$this->CI->dynamic_assets->add_css(base_url('js/vendor/fluxSlider/style.css'));
		
		ob_start();
		
		?>

		<script>
							 
			$(document).ready(function (){
					window.myFlux = new flux.slider('#<?php echo $this->att('id'); ?>', {
				        autoplay: false,
				        pagination: true
				    });
				});
			
		</script>
​
				<?php

		$this->CI->dynamic_assets->add_code_js(ob_get_clean());
	}
}